{layout name="../common/master"/}

<script src="__PUBLIC__/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/uploadify/uploadify.css">

<div id="right">
    <h4 style="border-bottom: 1px solid #ccc;padding-bottom: 3px">添加新模板
        <a href="{:URL('home/Sms/smsList')}" class="btn btn-success">返回</a>

    </h4>
    <div id="app">
        <form action="javascript:;" method="post" role="form" class="col-lg-6">
            <div class="form-group">
                <label for="">模板名称</label>
                <input type="text" class="form-control" required  name="name"  placeholder="请输入模板名称">
            </div>

            <div class="form-group">
                <label for="">模板编号</label>
                <input type="text" class="form-control" required  name="num"  placeholder="请输入模板编号">
            </div>
             <div class="form-group">
                <label for="">是否有效</label>
                 <div class="radio">
                     <label>
                         <input type="radio" name="is_valid" value="1" checked="checked">
                         有效
                     </label>
                     <label>
                         <input type="radio" name="is_valid" value="0">
                         无效
                     </label>
                 </div>
            </div>
            <div class="form-group">
                <label for="">平台</label>
                <div class="radio">
                    <label>
                        <input type="radio" name="plantForm" value="1" checked="checked">
                        短信模板
                    </label>
                    <label>
                        <input type="radio" name="plantForm" value="2">
                        推送模板
                    </label>
                    <label>
                        <input type="radio" name="plantForm" value="3">
                        语音模板
                    </label>
                </div>
            </div>

            <div class="form-group">
                <label for="">模板内容</label>(如有灵活内容请用[var]替换)
                <br/>
                <textarea id="uremark" placeholder="please repay money [var] in two days!" name="comment"  cols="20" rows="3"></textarea>
            </div>
            <button type="submit" id="form_submit" class="btn btn-primary">提交</button>
        </form>
    </div>
</div>
<script>
    $("#form_submit").click(function () {
        var data=$('form').serialize();
        $.post("{:URL('home/Sms/smsAdd')}",data,function(res){
           if(res.code == 0){
               layer.msg(res.msg);
               location.href="{:URL('home/Sms/smsList',['type'=>'list'])}";
           }else{
               layer.msg(res.data,function(){});
           }
        })
    })
</script>

